#include <cstdint>
#include <cstdio>
#include <iostream>
#include <vector>

using ll = int64_t;
using namespace std;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    freopen("merge.in", "r", stdin);
    freopen("merge.out", "w", stdout);
    ll T;
    cin >> T;
    while (T--) {
        ll n;
        cin >> n;
        vector<ll> a(n);
        for (ll i = 0; i < n; i++) {
            cin >> a[i];
        }
        ll i = 0, j = n - 1;
        ll ls = a[i];
        ll rs = a[j];
        ll op = 0;
        while (i < j) {
            if (ls == rs) {
                i++;
                j--;
                if (i < j) {
                    ls = a[i];
                    rs = a[j];
                }
            } else if (ls < rs) {
                i++;
                if (i < j) {
                    ls += a[i];
                }
                op++;
            } else {
                j--;
                if (i < j) {
                    rs += a[j];
                }
                op++;
            }
        }
        cout << op << '\n';
    }
}
